<?php include __DIR__.'/partials/header.php'; ?>
<?php
require 'notes/notes.php';
?>
<?php include '../partials/nav.php'; ?>
<div class="container">
<p>
        <a class="btn btn-success" href="create.php">Create new Note</a>
    </p>
    <?php 
$notes = getnotes();
    ?>
    <link rel="stylesheet" href="css/main.css"/>
    <br>
    <?php foreach ($notes as $note): ?>
    <div class="panel panel-default note row-no-padding" style="">
        <div class="panel-heading"><?php echo $note['name']; ?></div>
        <div class="panel-body"><?php echo $note['value'] ?><br/>
        <a href="view.php?id=<?php echo $note['id'] ?>" class="btn btn-sm btn-outline-info">View</a>
                    <a href="update.php?id=<?php echo$note['id'] ?>"
                       class="btn btn-sm btn-outline-secondary">Update</a>
                    <form method="POST" action="delete.php">
                        <input type="hidden" name="id" value="<?php echo $note['id'] ?>">
                        <button class="btn btn-sm btn-outline-danger">Delete</button>
                    </form>
    </div>
    </div>
</div>
<?php endforeach; ?>
<?php include __DIR__.'/partials/footer.php'; ?>